package com.mew.chess.core.game.pokdeng.game;

import com.mew.chess.core.game.pokdeng.game.message.UserMessage;
import com.zebra.common.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import lombok.*;

import java.util.ArrayList;
import java.util.List;


@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class PokDengSeatManager {

    private int seatNo;//座位号
    private UserMessage user;//玩家
    public void write(ByteBuf b){
        ByteBufUtils.writeInt(b,this.getSeatNo());
        //如果没有 就推一个空的User  推null前端不行
        if(this.getUser()==null){
            ByteBufUtils.writeLong(b,-1);
            ByteBufUtils.writeString(b,"");
            ByteBufUtils.writeInt(b, -1);
            ByteBufUtils.writeLong(b, -1);

            ByteBufUtils.writeLong(b,-1);
            ByteBufUtils.writeLong(b,-1);

            ByteBufUtils.writeInt(b,-1);
            ByteBufUtils.writeInt(b,-1);
            ByteBufUtils.writeInt(b,-1);
            ByteBufUtils.writeInt(b,-1);
        }else{
           this.getUser().write(b);
        }
    }
}
